//
//  HomepageTwoView.m
//  Blank
//
//  Created by 马博 on 15/9/28.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "HomepageTwoView.h"
#define windth [UIScreen mainScreen].bounds.size.width / 375
#define height ([UIScreen mainScreen].bounds.size.height > 568 ? [UIScreen mainScreen].bounds.size.height : 568) / 667


@implementation HomepageTwoView


/* 重写初始化, 初始化子控件 */
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        self.moveView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, windth * 375, height * 667)];
        [self addSubview:self.moveView];
        
        
        self.buttonInfo = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.buttonInfo setTitle:@"资讯" forState:UIControlStateNormal];
        
        [self.buttonInfo setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        
        self.buttonInfo.frame = CGRectMake(windth * 10, 5, [UIScreen mainScreen].bounds.size.width/2-Windth*10, 30 * height);
        [self.buttonInfo setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self addSubview:self.buttonInfo];
        
        
        self.buttonNew = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.buttonNew setTitle:@"热点" forState:UIControlStateNormal];
        self.buttonNew.frame = CGRectMake([UIScreen mainScreen].bounds.size.width/2, 5, [UIScreen mainScreen].bounds.size.width/2-Windth*10, 30 * height);
        [self addSubview:self.buttonNew];
        
        if ([NightModel getColorModel]) {
            
            self.moveView.backgroundColor = [UIColor grayColor];
        }
        else{
            
            self.moveView.backgroundColor = [UIColor whiteColor];
            
        }
         [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(changeNightModel) name:@"nightModelChange" object:nil];
        
    }
    
    return self;
}

- (void)changeNightModel
{
    if ([NightModel getColorModel]) {
       
        self.moveView.backgroundColor = [UIColor lightGrayColor];
    }
    else{
        
        self.moveView.backgroundColor = [UIColor whiteColor];
        
    }

}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
